package it.niedermann.android.markdown.markwon.plugins


import com.github.yeicor.kraphviz.Kraphviz
import io.noties.markwon.plugin.typogram.parser.QuickParser
import org.junit.Test
import timber.log.Timber

class KraphvizTest {
  val sampleGrap="""
      digraph g {
    rankdir=LR  //方向左右
    dot语言->{简介,语法,示例}
    dot语言[shape=box,fontcolor=red]
    简介[color=red]
    语法[color=green]
    示例[color=blue]
    简介->{开源免费,UML绘图,导出svg}
    语法->{"digraph","graph"}
    "digraph"->导向图[label=可以制作带方向的导图]
    "graph"->无向图[label=可以制作不带方向的导图]
    }
  """.trimIndent()

    val sampleGrapMmarid="""
        graph LR
    A[方块] -- 连线 --> B((圆形))
    B --> C{菱形}
    C -->|条件a| D[方块]
    C -->|条件b| E[方块]
    F(圆角矩形) -.-> E
    """.trimIndent()

    @Test
    fun testContains() {
        val parserGraphviz= Kraphviz()
        val disSvgStr=parserGraphviz.render(sampleGrapMmarid)

        val svg = QuickParser().renderWithSize(disSvgStr)

        println("graphviz render svg:${svg}")
    }
}